#! /bin/sh /usr/share/dpatch/dpatch-run
## compressed-wav-files.dpatch by Stefan Fritsch <sf@sfritsch.de>
##
## DP: afGetVirtualFrameSize() needs to be used instead of afGetFrameSize(),
## DP: otherwise the allocated buffer size is too small for compressed
## DP: WAV files (see #558399).

@DPATCH@
diff -urNad normalize-audio-0.7.7~/src/adjust.c normalize-audio-0.7.7/src/adjust.c
--- normalize-audio-0.7.7~/src/adjust.c	2009-01-29 21:25:27.000000000 +0100
+++ normalize-audio-0.7.7/src/adjust.c	2009-11-28 17:23:40.000000000 +0100
@@ -277,8 +277,8 @@
 
   /* set up buffer to hold 1/100 of a second worth of frames */
   frames_in_buf = samp_rate / 100;
-  src_framesz = afGetFrameSize(fhin, AF_DEFAULT_TRACK, 1);
-  dst_framesz = afGetFrameSize(fhout, AF_DEFAULT_TRACK, 1);
+  src_framesz = afGetVirtualFrameSize(fhin, AF_DEFAULT_TRACK, 1);
+  dst_framesz = afGetVirtualFrameSize(fhout, AF_DEFAULT_TRACK, 1);
   src_buf = (unsigned char *)xmalloc(frames_in_buf * src_framesz);
   dst_buf = (unsigned char *)xmalloc(frames_in_buf * dst_framesz);
 
